﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BusinessLayer;

namespace PresentationLayer
{
    public partial class AssociarProfADep : Form
    {
        public AssociarProfADep()
        {
            InitializeComponent();
        }

        private void btnAssProfDep_Click(object sender, EventArgs e)
        {
            this.textBoxIdDep.SelectAll();
            this.textBoxIdOfic.SelectAll();
            this.textBoxIdProf.SelectAll();
            String dep, ofic, prof;
            if ((dep = this.textBoxIdDep.SelectedText) == "" ||
                (ofic = this.textBoxIdOfic.SelectedText) == "" ||
                (prof = this.textBoxIdProf.SelectedText) == "")
            {
                MessageBox.Show("Todos os dados são obrigatórios");
                return;
            }

            if(ProfissaoActions.AssociarProfissaoDepartamento(prof,ofic, dep))
                this.Close();
        }
    }
}
